<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>金融资产流转管理</title>
    <link rel="stylesheet" href="../../js/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.css">
    <link rel="stylesheet" href="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.css">

    <script src="../../js/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="../../js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../js/bower_components/bootbox.min.js"></script>
    <script src="../../js/bower_components/bootstrap-select/js/bootstrap-select.js"></script>
    <script src="../../js/bower_components/bootstrap-switch/dist/js/bootstrap-switch.min.js"></script>
    <script src="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.js"></script>
    <script src="../../js/bower_components/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>
    <script src="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.js"></script>
    <script src="../../js/bower_components/jquery-form-validator/form-validator/jquery.form-validator.min.js"></script>
    <script src="../../js/bower_components/moment/min/moment-with-locales.min.js"></script>
    <script>
        $(function () {
            $("#shiftList").hide();
            createSelect();
            createTblCheckoutResult();

            $('#selTransType').on("change",function () {
                if($(this).val()==1){
                    $("#shiftList").hide();
                    $("#checkOutList").show();
                    createTblCheckoutResult();
                }
                if ($(this).val()==2){
                    $("#shiftList").show();
                    $("#checkOutList").hide();
                    createTblShiftResult();
                }
            });
        });

        function createSelect() {
            $('#selTransType').selectpicker({width:'130px'});
            $('#selTransType').empty();

            //资产领用
            //资产转移
            option1 = new Option("资金提取","1");
            option2 = new Option("管理转移","2");

            $('#selTransType').append(option1);
            $('#selTransType').append(option2);

            $('#selTransType').selectpicker('refresh');
            $('#selTransType').selectpicker('render');
        }

        function createTblCheckoutResult() {
            $("#tblCheckoutResult").bootstrapTable('destroy');
            $("#tblCheckoutResult").bootstrapTable({
                //url:"bookServlet",
                data:'',
                method:'post',
                pagination: true,
                sidePagination:'client',//'server',
                singleSelect: false,
                clickToSelect: true,
                contentType:'application/x-www-form-urlencoded; charset=UTF-8',
                queryParams:function(param) {
                    return {
                        'pageSize':param.limit,
                        'pageIndex':(param.offset / param.limit),
                        'press':$('#pressCategory').val(),
                        'author':$('#txtAuthorName').val(),
                        'publishtime':$('#tbxInstockDate').val(),
                        'edition':$('#cbkConsumptive').bootstrapSwitch('state')
                    };
                },
                onClickRow:function(row){
                    //alert(row.bid);
                    gbid=row.bid;
                },
                onCheck:function(row){
                    //alert(row.bid);
                },
                responseHandler:function(res){
                    return {
                        "total": res.total,//总页数
                        "rows": res.rows //数据
                    };
                },
                columns: [
                    {field:'value',title:"<span class='glyphicon glyphicon-tags' /> 资产编号", halign:'center'},
                    {field:'display', title:"资产名称", halign:'center'},
                    {field:'typecode', title:"批次编号", halign:'center'},
                    {field:'desc', title:"单价（￥）", halign:'center'},
                    {field:'desc', title:"持有数量", halign:'center'},
                    {field:'desc', title:"当前持有人", halign:'center'},
                    {field:'desc', title:"领用时间", halign:'center'},
                    {field:'desc', title:"转移操作", halign:'center'}

                ]
            });
        }
        function createTblShiftResult() {
            $("#tblShiftResult").bootstrapTable('destroy');
            $("#tblShiftResult").bootstrapTable({
                //url:"bookServlet",
                data:'',
                method:'post',
                pagination: true,
                sidePagination:'client',//'server',
                singleSelect: false,
                clickToSelect: true,
                contentType:'application/x-www-form-urlencoded; charset=UTF-8',
                queryParams:function(param) {
                    return {
                        'pageSize':param.limit,
                        'pageIndex':(param.offset / param.limit),
                        'press':$('#pressCategory').val(),
                        'author':$('#txtAuthorName').val(),
                        'publishtime':$('#tbxInstockDate').val(),
                        'edition':$('#cbkConsumptive').bootstrapSwitch('state')
                    };
                },
                onClickRow:function(row){
                    //alert(row.bid);
                    gbid=row.bid;
                },
                onCheck:function(row){
                    //alert(row.bid);
                },
                responseHandler:function(res){
                    return {
                        "total": res.total,//总页数
                        "rows": res.rows //数据
                    };
                },
                columns: [
                    {field:'value',title:"<span class='glyphicon glyphicon-tags' /> 资产编号", halign:'center'},
                    {field:'display', title:"资产名称", halign:'center'},
                    {field:'typecode', title:"批次编号", halign:'center'},
                    {field:'desc', title:"单价（￥）", halign:'center'},
                    {field:'desc', title:"持有数量", halign:'center'},
                    {field:'desc', title:"当前持有人", halign:'center'},
                    {field:'desc', title:"领用时间", halign:'center'},
                    {field:'desc', title:"转移操作", halign:'center'}
                ]
            });
        }
    </script>
</head>
<body>
<div class="container-fluid">
    <div class="row col-md-10">
        <div id="divSearchForm" class="form-inline">
            <div class="form-group">
                <label class="control-label" for="selTransType">资产操作：</label>
                <select id="selTransType" >
                    <option value="2" selected="selected">资金提取</option>
                    <option value="4">管理转移</option>
                </select>
            </div>
            <div class="form-group">
                <label class="control-label" for="tbxAssetsName">资产名称：</label>
                <input class="form-control" type="text" id="tbxAssetsName" />
            </div>
            <div class="form-group">
                <label class="control-label" for="tbxBatchNo">批次编号：</label>
                <input class="form-control" type="text" id="tbxBatchNo" />
            </div>
            <div class="form-group">
                <button type="button" id="btnSearch" class="btn btn-primary">
                    <span class="glyphicon glyphicon-search" />
                    检索Search
                </button>
            </div>
        </div>
    </div>
    <div id="checkOutList" class="row col-md-10">
        <h4>可提取资金列表：</h4>
        <table id="tblCheckoutResult"></table>
    </div>
    <div id="shiftList" class="row col-md-10">
        <h4>可转移资金列表：</h4>
        <table id="tblShiftResult"></table>
    </div>
</div>
</body>
</html>